<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        .lg {
            width: 300px;
            height: 300px;
            background-color: #56a5f1;
        }
        .mid {
            width: 200px;
            height: 200px;
            background-color: red;
        }
        .sm {
            width: 100px;
            height: 100px;
            background-color: green;
        }
    </style>
</head>
<body>
    <div id="app">
        <p>1.事件修饰符</p>
        <p>stop-阻止冒泡</p>
        <div class="lg" @click="fn1('lg')">
            <div class="mid" @click.stop="fn1('mid')">
                <div class="sm" @click.stop="fn1('sm')"></div>
            </div>
        </div>
        <hr>
        <p>prevent-阻止默认事件</p>
        <div class="lg" @contextmenu.prevent="fn2"></div>
        <p>self-事件只能由自己触发</p>
        <div class="lg" @click.self="fn1('lg')">
            <div class="mid" @click.self="fn1('mid')">
                <div class="sm" @click="fn1('sm')"></div>
            </div>
        </div>
        <hr>
        <p>once 只生效一次，防抖截流</p>
        <button @click.once="fn3">buy</button>
    </div>
    <script src="../0511/js/vue.js"></script>
    <script>
        let vm = new Vue({
            el: '#app',
            data: {
                
            },
            methods: {
                fn1(name) {
                    console.log(name);
                },
                fn2() {
                    console.log('你右键了！');
                },
                fn3() {
                    console.log(123);
                }
            }
        })
    </script>
</body>
</html>